<?php app::import('model', 'Departamento') ?>
<?php $dpto = new Departamento() ?>
<?php app::import('model', 'Provincia') ?>
<?php $prov = new Provincia() ?>
<?php app::import('model', 'SegurosPaciente') ?>
<?php $seguro = new SegurosPaciente()?>
<div id="content">
    <div class="grid_container">
        <!--datos del paciente--> 
        <div class="grid_12 full_block">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list_image"></span>
                    <h6>Datos ficha consulta externa pacientes</h6>
                </div>
                <div class="widget_content">
                    
                    <form action="#" method="post" class="form_container left_label">
                        <ul>
                            <li>
                                <div class="form_grid_4">
                                    <label class="field_title">Fecha</label>
                                    <div class="form_input">
                                        <span>
                                            
                                            <label class="label_datos">
                                                <?php echo $this->Fechas->actual_date($datosconsulta['Consultasexterna']['fecha']); ?>
                                            </label>
                                        </span><span>

                                    </div>
                                </div>
                            
                                <div class="form_grid_4">
                                    
                                        <h6>FICHA CONSULTA EXTERNA # <?php echo $datosconsulta['Consultasexterna']['id'] ?></h6>
                                         
                                </div>
                              
                                <div class="form_grid_4">
                                    <label class="field_title">Hora</label>
                                    <div class="form_input">
                                        <span>
                                            
                                            <label class="label_datos">
                                                <?php echo $datosconsulta['Consultasexterna']['hora']?>
                                            </label>
                                        </span><span>

                                    </div>
                                </div>
                                <div class="clear"></div>
                            </li>
                           
                            <li>
                                <div class="form_grid_2">
                                    <label class="field_title">Nro H.C. : </label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                         <?php echo $datosconsulta['Paciente']['codigo']?>   
                                        </span>
                                    </div>
                                </div>
                                <div class="form_grid_6">
                                    <label class="field_title">Nombre paciente</label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                         <?php echo $datosconsulta['Paciente']['ap_paterno'] . ' ' . $datosconsulta['Paciente']['ap_materno'] . ' ' . $datosconsulta['Paciente']['nombres'] ?>   
                                        </span>
                                    </div>
                                </div>
                                <div class="form_grid_2">
                                    <label class="field_title">Sexo</label>
                                    <div class="form_input">
                                    <span class="label_datos">
                                        <?php echo $datosconsulta['Paciente']['sexo'] ?>
                                    </span>
                                    </div>
                                </div>
                                <div class="form_grid_2">
                                    <label class="field_title">Edad</label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                         <?php echo $datosconsulta['Consultasexterna']['edad']?>   
                                        </span>
                                    </div>
                                </div>
<!--                                <div class="clear"></div>
                            </li>
                            <li>-->
                                <div class="form_grid_4">
                                    <label class="field_title">Seguro</label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                            <?php $datosseguro=$seguro->find('first', array('conditions'=>array('SegurosPaciente.paciente_id'=>$datosconsulta['Paciente']['id'])))?>
                                            <?php echo $datosseguro['Seguro']['nombre']?>
                                            <?php if(!empty($datosseguro['SegurosPaciente']['curso'])){
                                                echo $datosseguro['SegurosPaciente']['curso'];
                                            }?>
                                        </span>
                                    </div>
                                </div>
                                <div class="form_grid_4">
                                    <label class="field_title">Telefonos</label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                            <?php echo $datosconsulta['Paciente']['telefono']?>&nbsp;<?php echo $datosconsulta['Paciente']['celular']?>
                                        </span>
                                    </div>
                                </div>
<!--                                <div class="clear"></div>
                            </li>
                            <li>-->
                                <div class="form_grid_6">
                                    <label class="field_title">Procedencia</label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                            <?php echo $datosconsulta['Paciente']['pais'].' '.$datosconsulta['Paciente']['ciudad']?>
                                        </span>
                                    </div>
                                </div>
                            
                                <div class="form_grid_6">
                                    <label class="field_title">Residencia</label>
                                    <div class="form_input">
                                        <span class="label_datos">
                                             <?php
                                    if ($datosconsulta['Paciente']['lugar'] == 'provincia') {
                                        $departamento = $dpto->find('first', array('conditions' => array('Departamento.id' => $datosconsulta['Paciente']['departamento_id_p']), 'recursive' => -1));
                                        $provincia = $prov->find('first', array('conditions' => array('Provincia.id' => $datosconsulta['Paciente']['provincia_id_p'])));
                                        $localidad = $datosconsulta['Paciente']['localidad'];
                                    } else {
                                        $departamento = $dpto->find('first', array('conditions' => array('Departamento.id' => $datosconsulta['Paciente']['departamento_id']), 'recursive' => -1));
                                        $provincia = $prov->find('first', array('conditions' => array('Provincia.id' => $datosconsulta['Paciente']['provincia_id'])));
                                        $localidad = '';
                                    }
                                    ?> 
                                    <?php
                                    echo $departamento['Departamento']['nombre'] . ' /' .
                                    $departamento['Provincia']['nombre'] . ' ' .
                                    $localidad
                                    ?>
                                        </span>                                        
                                    </div>
                                </div>
                                <div class="clear"></div>
                            </li>
                            <?php
                        $verificaColor = $alertaPaciente['Alerta']['color'];
                        //debug($color);
                        switch ($verificaColor)
                        {
                            case "rojo":
                                $color = "#D66";
                                $alerta = "ROJA";
                                break;
                            case "amarillo":
                                $color = "#FFFFAA";
                                $alerta = "AMARILLA";
                                break;
                            case "verde":
                                $color = "#008000";
                                $alerta = "VERDE";
                                break;
                            case "blanco":
                                $color = "#FFF";
                                $alerta = "BLANCA";
                                break;
                            default:
                                echo "No existe la alerta";
                        }
                        ?>
                            <li>
                                
                                <div class="form_grid_6">
                                    <label class="field_title"> <span class="label_intro">Categorizacion del enfermo</span></label>
                                    <div class="form_input" style="background: <?php echo $color?>">
                                        <label class="label_datos">
                                            <?php if(!empty($datosconsulta['AlertasPaciente'])):?>
                                            <?php echo $datosconsulta['Alerta']['nombre']?>
                                            <?php endif;?>
                                        </label>
                                        
                                    </div>
                                </div>
                                <div class="form_grid_6">
                                    <label class="field_title"> <span class="label_intro">Categorizacion del enfermo</span></label>
                                    <div class="form_input">
                                        <textarea name="filed05" id="txt_editor" cols="50" rows="5" tabindex="4"></textarea>
                                    </div>
                                </div>
                                <div class="clear"></div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title"> <span class="label_intro">Normal Text Area</span></label>
                                    <div class="form_input">
                                        <textarea name="filed05" id="txt_editor" cols="50" rows="5" tabindex="4"></textarea>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Tags </label>
                                    <div class="form_input">
                                        <input id="tags_1" type="text" class="tags" value="foo,bar,baz,roffle"/>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Textarea <span class="label_intro">Auto Grow Textarea</span></label>
                                    <div class="form_input">
                                        <textarea name="filed06" class="input_grow" cols="50" rows="5" tabindex="5"></textarea>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Text Input <span class="label_intro">Text Input With Placeholder</span></label>
                                    <div class="form_input">
                                        <input name="filed07" placeholder="Placholder Text" type="text" tabindex="6"/>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Checkbox</label>
                                    <div class="form_input">
                                        <span>
                                            <input name="field08" class="checkbox" type="checkbox" value="First" tabindex="7">
                                            <label class="choice">First</label>
                                        </span><span>
                                            <input name="field09" class="checkbox" type="checkbox" value="Second" tabindex="8">
                                            <label class="choice">Second</label>
                                        </span><span>
                                            <input name="field10" class="checkbox" type="checkbox" value="Third" tabindex="9">
                                            <label class="choice">Third</label>
                                        </span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Radio Button</label>
                                    <div class="form_input">
                                        <span>
                                            <input name="field11" class="radio" type="radio" value="First" tabindex="10">
                                            <label class="choice">First</label>
                                        </span>
                                        <span>
                                            <input name="field12" class="radio" type="radio" value="Second" tabindex="11">
                                            <label class="choice">Second</label>
                                        </span><span>
                                            <input name="field13" class="radio" type="radio" value="Third" tabindex="12">
                                            <label class="choice">Third</label>
                                        </span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Select Box <span class="label_intro">This is a seletbox</span></label>
                                    <div class="form_input">
                                        <select data-placeholder="Your Favorite Football Team" style=" width:300px" class="chzn-select" tabindex="13">
                                            <option value=""></option>
                                            <optgroup label="NFC EAST">
                                                <option>Dallas Cowboys</option>
                                                <option>New York Giants</option>
                                                <option>Philadelphia Eagles</option>
                                                <option>Washington Redskins</option>
                                            </optgroup>
                                            <optgroup label="NFC NORTH">
                                                <option>Chicago Bears</option>
                                                <option>Detroit Lions</option>
                                                <option>Green Bay Packers</option>
                                                <option>Minnesota Vikings</option>
                                            </optgroup>
                                            <optgroup label="NFC SOUTH">
                                                <option>Atlanta Falcons</option>
                                                <option>Carolina Panthers</option>
                                                <option>New Orleans Saints</option>
                                                <option>Tampa Bay Buccaneers</option>
                                            </optgroup>
                                            <optgroup label="NFC WEST">
                                                <option>Arizona Cardinals</option>
                                                <option>St. Louis Rams</option>
                                                <option>San Francisco 49ers</option>
                                                <option>Seattle Seahawks</option>
                                            </optgroup>
                                            <optgroup label="AFC EAST">
                                                <option>Buffalo Bills</option>
                                                <option>Miami Dolphins</option>
                                                <option>New England Patriots</option>
                                                <option>New York Jets</option>
                                            </optgroup>
                                            <optgroup label="AFC NORTH">
                                                <option>Baltimore Ravens</option>
                                                <option>Cincinnati Bengals</option>
                                                <option>Cleveland Browns</option>
                                                <option>Pittsburgh Steelers</option>
                                            </optgroup>
                                            <optgroup label="AFC SOUTH">
                                                <option>Houston Texans</option>
                                                <option>Indianapolis Colts</option>
                                                <option>Jacksonville Jaguars</option>
                                                <option>Tennessee Titans</option>
                                            </optgroup>
                                            <optgroup label="AFC WEST">
                                                <option>Denver Broncos</option>
                                                <option>Kansas City Chiefs</option>
                                                <option>Oakland Raiders</option>
                                                <option>San Diego Chargers</option>
                                            </optgroup>
                                        </select>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Multiple Select</label>
                                    <div class="form_input">
                                        <select data-placeholder="Your Favorite Types of Bear" style="width:300px;" multiple class="chzn-select" tabindex="14">
                                            <option value=""></option>
                                            <option>American Black Bear</option>
                                            <option>Asiatic Black Bear</option>
                                            <option>Brown Bear</option>
                                            <option>Giant Panda</option>
                                            <option selected>Sloth Bear</option>
                                            <option disabled>Sun Bear</option>
                                            <option selected>Polar Bear</option>
                                            <option disabled>Spectacled Bear</option>
                                        </select>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Multiple Select with Groups</label>
                                    <div class="form_input">
                                        <select data-placeholder="Your Favorite Football Team" style="width:300px;" class="chzn-select" multiple tabindex="15">
                                            <option value=""></option>
                                            <optgroup label="NFC EAST">
                                                <option>Dallas Cowboys</option>
                                                <option>New York Giants</option>
                                                <option>Philadelphia Eagles</option>
                                                <option>Washington Redskins</option>
                                            </optgroup>
                                            <optgroup label="NFC NORTH">
                                                <option>Chicago Bears</option>
                                                <option>Detroit Lions</option>
                                                <option>Green Bay Packers</option>
                                                <option>Minnesota Vikings</option>
                                            </optgroup>
                                            <optgroup label="NFC SOUTH">
                                                <option>Atlanta Falcons</option>
                                                <option>Carolina Panthers</option>
                                                <option>New Orleans Saints</option>
                                                <option>Tampa Bay Buccaneers</option>
                                            </optgroup>
                                            <optgroup label="NFC WEST">
                                                <option>Arizona Cardinals</option>
                                                <option>St. Louis Rams</option>
                                                <option>San Francisco 49ers</option>
                                                <option>Seattle Seahawks</option>
                                            </optgroup>
                                            <optgroup label="AFC EAST">
                                                <option>Buffalo Bills</option>
                                                <option>Miami Dolphins</option>
                                                <option>New England Patriots</option>
                                                <option>New York Jets</option>
                                            </optgroup>
                                            <optgroup label="AFC NORTH">
                                                <option>Baltimore Ravens</option>
                                                <option>Cincinnati Bengals</option>
                                                <option>Cleveland Browns</option>
                                                <option>Pittsburgh Steelers</option>
                                            </optgroup>
                                            <optgroup label="AFC SOUTH">
                                                <option>Houston Texans</option>
                                                <option>Indianapolis Colts</option>
                                                <option>Jacksonville Jaguars</option>
                                                <option>Tennessee Titans</option>
                                            </optgroup>
                                            <optgroup label="AFC WEST">
                                                <option>Denver Broncos</option>
                                                <option>Kansas City Chiefs</option>
                                                <option>Oakland Raiders</option>
                                                <option>San Diego Chargers</option>
                                            </optgroup>
                                        </select>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Deselect on Single Selects</label>
                                    <div class="form_input">
                                        <select data-placeholder="Your Favorite Type of Bear" style="width:300px;" class="chzn-select-deselect" tabindex="16">
                                            <option value=""></option>
                                            <option>American Black Bear</option>
                                            <option>Asiatic Black Bear</option>
                                            <option>Brown Bear</option>
                                            <option>Giant Panda</option>
                                            <option selected>Sloth Bear</option>
                                            <option>Sun Bear</option>
                                            <option>Polar Bear</option>
                                            <option>Spectacled Bear</option>
                                        </select>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Group Radio</label>
                                    <div class="form_input">
                                        <div class="form_grid_2 alpha">
                                            <fieldset>
                                                <legend>Legend</legend>
                                                <span class="column_input">
                                                    <input name="field14" class="radio" type="radio" value="First" tabindex="17">
                                                    <label class="choice">First</label>
                                                </span><span class="column_input">
                                                    <input name="field14" class="radio" type="radio" value="Second" tabindex="18">
                                                    <label class="choice">Second</label>
                                                </span><span class="column_input">
                                                    <input name="field14" class="radio" type="radio" value="Third" tabindex="19">
                                                    <label class="choice">Third</label>
                                                </span>
                                            </fieldset>
                                        </div>
                                        <div class="form_grid_2">
                                            <fieldset>
                                                <legend>Legend</legend>
                                                <span class="column_input">
                                                    <input name="field15" class="radio" type="radio" value="First" tabindex="20">
                                                    <label class="choice">First</label>
                                                </span><span class="column_input">
                                                    <input name="field15" class="radio" type="radio" value="Second" tabindex="21">
                                                    <label class="choice">Second</label>
                                                </span><span class="column_input">
                                                    <input name="field15" class="radio" type="radio" value="Third" tabindex="22">
                                                    <label class="choice">Third</label>
                                                </span>
                                            </fieldset>
                                        </div>
                                        <div class="form_grid_2">
                                            <fieldset>
                                                <legend>Legend</legend>
                                                <span class="column_input">
                                                    <input name="field16" class="radio" type="radio" value="First" tabindex="23">
                                                    <label class="choice">First</label>
                                                </span><span class="column_input">
                                                    <input name="field16" class="radio" type="radio" value="Second" tabindex="24">
                                                    <label class="choice">Second</label>
                                                </span><span class="column_input">
                                                    <input name="field16" class="radio" type="radio" value="Third" tabindex="25">
                                                    <label class="choice">Third</label>
                                                </span>
                                            </fieldset>
                                        </div>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">File Input</label>
                                    <div class="form_input">
                                        <input name="file01" type="file">
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Rating</label>
                                    <div class="form_input">
                                        <div id="star">
                                        </div>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Dual List</label>
                                    <div class="form_input">
                                        <div class="list_left">
                                            <div class="list_filter">
                                                <label>Filter: </label>
                                                <input type="text" id="box1Filter"/>
                                                <span id="box1Clear" class="list_refresh"><span class="filter_btn refresh_3">&nbsp;</span></span>
                                            </div>
                                            <select id="box1View" multiple="multiple" class="multiple_list">
                                                <option value="501649">2008-2009 "Mini" Baja</option>
                                                <option value="501497">AAPA - Asian American Psychological Association</option>
                                                <option value="501053">Academy of Film Geeks</option>
                                                <option value="500001">Accounting Association</option>
                                                <option value="501227">ACLU</option>
                                                <option value="501610">Active Minds</option>
                                                <option value="501514">Activism with A Reel Edge (A.W.A.R.E.)</option>
                                                <option value="501656">Adopt a Grandparent Program</option>
                                                <option value="501050">Africa Awareness Student Organization</option>
                                                <option value="501075">African Diasporic Cultural RC Interns</option>
                                                <option value="501493">Agape</option>
                                                <option value="501562">AGE-Alliance for Graduate Excellence</option>
                                                <option value="500676">AICHE (American Inst of Chemical Engineers)</option>
                                                <option value="501460">AIDS Sensitivity Awareness Project ASAP</option>
                                                <option value="500004">Aikido Club</option>
                                                <option value="500336">Akanke</option>
                                            </select>
                                            <div class="list_itemcount">
                                                <span id="box1Counter" class="countLabel"></span>
                                                <select id="box1Storage">
                                                </select>
                                            </div>
                                        </div>
                                        <div class="list_switch">
                                            <span id="to2" class="swap_btn"><span class="filter_btn p_next">&nbsp;</span></span><span id="to1" class="swap_btn"><span class="filter_btn p_prev">&nbsp;</span></span><span id="allTo2" class="swap_btn"><span class="filter_btn p_last">&nbsp;</span></span><span id="allTo1" class="swap_btn"><span class="filter_btn p_first">&nbsp;</span></span>
                                        </div>
                                        <div class="list_right">
                                            <div class="list_filter">
                                                <label>Filter: </label>
                                                <input type="text" id="box2Filter"/>
                                                <span class="list_refresh" id="box2Clear"><span class="filter_btn refresh_3">&nbsp;</span></span>
                                            </div>
                                            <select id="box2View" multiple="multiple" class="multiple_list">
                                            </select>
                                            <div class="list_itemcount">
                                                <span id="box2Counter" class="countLabel"></span>
                                                <select id="box2Storage">
                                                </select>
                                            </div>
                                        </div>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Spinner</label>
                                    <div class="form_input">
                                        <input type="text" class="spinner" id="spinner" value="0"/>
                                        <input type="text" id="spinnerhide" value="0" class="spinner"/>
                                        <input type="text" class="spinner" id="spinnercurrency"/>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Date Picker</label>
                                    <div class="form_input">
                                        <div class=" form_grid_2 alpha">
                                            <input name="filed30" type="text" class="datepicker"/>
                                            <span class=" label_intro">From</span>
                                        </div>
                                        <div class=" form_grid_2">
                                            <input name="filed31" type="text" class="datepicker"/>
                                            <span class=" label_intro">To</span>
                                        </div>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Iphone Style Button</label>
                                    <div class="form_input on_off">
                                        <input type="checkbox" checked="checked" id="on_off_on"/>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">iButton</label>
                                    <div class="form_input field switch">
                                        <label class="cb-enable selected"><span>Enable</span></label>
                                        <label class="cb-disable"><span>Disable</span></label>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title">Mask Input</label>
                                    <div class="form_input">
                                        <div class="form_grid_2 alpha">
                                            <input name="date" type="text" id="date"/>
                                            <span class=" label_intro">Date</span>
                                        </div>
                                        <div class="form_grid_3">
                                            <input name="phone" type="text" id="phone"/>
                                            <span class=" label_intro">Phone</span>
                                        </div>
                                        <div class="form_grid_2">
                                            <input name="tin" type="text" id="tin"/>
                                            <span class=" label_intro">Tin</span>
                                        </div>
                                        <div class="form_grid_2">
                                            <input name="ssn" type="text" id="ssn"/>
                                            <span class=" label_intro">SSN</span>
                                        </div>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <button type="submit" class="btn_small btn_gray"><span>Submit</span></button>
                                        <button type="reset" class="btn_small btn_gray"><span>Reset</span></button>
                                        <button type="submit" class="btn_small btn_blue"><span>Submit</span></button>
                                        <button type="reset" class="btn_small btn_blue"><span>Reset</span></button>
                                        <button type="submit" class="btn_small btn_orange"><span>Submit</span></button>
                                        <button type="reset" class="btn_small btn_orange"><span>Reset</span></button>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>